import Vue from 'vue'
import VueRouter from 'vue-router'
import Qualityspace from '@/views/index/Qualityspace'
import All from '@/views/center/myorder/All'
import Waitpay from '@/views/center/myorder/Waitpay'
import Deliver from '@/views/center/myorder/Deliver'
import Harvest from '@/views/center/myorder/Harvest'
import Comment from '@/views/center/myorder/Comment'
import Returned from '@/views/center/myorder/Returned'
import Brand from '@/views/center/collect/Brand'
import Designer from '@/views/center/collect/Designer'
import Oneproducte from '@/views/center/collect/Oneproducte'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/index'
  },
  {
    path: '/meau',
    component: () => import('@/views/Meau')
  },
  {
    path: '/meau/:id',
    component: () => import('@/views/meau/Meaudetail')
  },
  {
    path: '/index',
    component: () => import('@/views/Index'),
    children: [
      {
        path: '/index/qualityspace',
        component: Qualityspace
      },
      { // 居家好物
        path: '/index/homegoods',
        component: () => import('@/views/index/HomeGoods')
      }
    ]
  },
  {
    path: '/shopcar',
    component: () => import('@/views/Shopcar')
  },
  {
    path: '/tips',
    component: () => import('@/views/Tips')
  },
  {
    path: '/center',
    component: () => import('@/views/Center')
  },
  {
    path: '/center/usermassage',
    component: () => import('@/views/center/Usermassage')
  },
  {
    path: '/center/collect',
    component: () => import('@/views/center/Collect'),
    children: [
      {
        path: '/center/collect/brand',
        component: Brand
      },
      {
        path: '/center/collect/designer',
        component: Designer
      },
      {
        path: '/center/collect/oneproducte',
        component: Oneproducte
      }
    ]
  },
  {
    path: '/center/coupons',
    component: () => import('@/views/center/Coupons')
  },
  {
    path: '/center/myorder',
    component: () => import('@/views/center/Myorder'),
    children: [
      {
        path: '/center/myorder/all',
        component: All
      },
      {
        path: '/center/myorder/waitpay',
        component: Waitpay
      },
      {
        path: '/center/myorder/deliver',
        component: Deliver
      },
      {
        path: '/center/myorder/harvest',
        component: Harvest
      },
      {
        path: '/center/myorder/comment',
        component: Comment
      }
    ]
  },
  {
    path: '/center/myorder/returned',
    component: Returned
  },
  {
    path: '/item/:id',
    component: () => import ('@/views/item')
  },
  {
    path: '/login',
    component: () => import('@/views/isLogin/Login')
  },
  {
    path: '/registered',
    component: () => import('@/views/isLogin/Registered')
  }
]

const router = new VueRouter({
    mode: 'hash',
    base: process.env.BASE_URL,
    routes
})

export default router